package util;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author yujie
 * @createTime 2023/1/3 14:13
 * @description
 */
@Slf4j
public class Prop {

    private static final Properties properties;

    static {
        properties = new Properties();
        InputStream resourceAsStream = Prop.class.getClassLoader().getResourceAsStream("app.properties");
        try {
            properties.load(resourceAsStream);
        } catch (IOException e) {
            log.error("配置文件配置失败:{}", e.getMessage());
            throw new RuntimeException(e);
        }
    }

    public static String get(String key){
        return String.valueOf(properties.get(key));
    }

}
